/*     */ package com.alipay.api;
/*     */ 
/*     */ import com.alipay.api.internal.parser.json.ObjectJsonParser;
/*     */ import com.alipay.api.internal.parser.xml.ObjectXmlParser;
/*     */ import com.alipay.api.internal.util.AlipayEncrypt;
/*     */ import com.alipay.api.internal.util.AlipayHashMap;
/*     */ import com.alipay.api.internal.util.AlipayLogger;
/*     */ import com.alipay.api.internal.util.AlipaySignature;
/*     */ import com.alipay.api.internal.util.AlipayUtils;
/*     */ import com.alipay.api.internal.util.RequestParametersHolder;
/*     */ import com.alipay.api.internal.util.StringUtils;
/*     */ import com.alipay.api.internal.util.WebUtils;
/*     */ import com.alipay.api.internal.util.json.JSONWriter;
/*     */ import java.io.IOException;
/*     */ import java.security.Security;
/*     */ import java.text.DateFormat;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import java.util.TimeZone;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DefaultAlipayClient
/*     */   implements AlipayClient
/*     */ {
/*     */   private String serverUrl;
/*     */   private String appId;
/*     */   private String privateKey;
/*     */   private String prodCode;
/*  39 */   private String format = "json";
/*  40 */   private String sign_type = "RSA";
/*     */   
/*  42 */   private String encryptType = "AES";
/*     */   
/*     */   private String encryptKey;
/*     */   
/*     */   private String alipayPublicKey;
/*     */   
/*     */   private String charset;
/*     */   
/*  50 */   private int connectTimeout = 3000;
/*  51 */   private int readTimeout = 15000;
/*     */ 
/*     */   
/*     */   static {
/*  55 */     Security.setProperty("jdk.certpath.disabledAlgorithms", "");
/*     */   }
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey) {
/*  59 */     this.serverUrl = serverUrl;
/*  60 */     this.appId = appId;
/*  61 */     this.privateKey = privateKey;
/*  62 */     this.alipayPublicKey = null;
/*     */   }
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey, String format) {
/*  66 */     this(serverUrl, appId, privateKey);
/*  67 */     this.format = format;
/*     */   }
/*     */ 
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey, String format, String charset) {
/*  72 */     this(serverUrl, appId, privateKey);
/*  73 */     this.format = format;
/*  74 */     this.charset = charset;
/*     */   }
/*     */ 
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey, String format, String charset, String alipayPulicKey) {
/*  79 */     this(serverUrl, appId, privateKey);
/*  80 */     this.format = format;
/*  81 */     this.charset = charset;
/*  82 */     this.alipayPublicKey = alipayPulicKey;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey, String format, String charset, String alipayPulicKey, String signType) {
/*  88 */     this(serverUrl, appId, privateKey, format, charset, alipayPulicKey);
/*     */     
/*  90 */     this.sign_type = signType;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public DefaultAlipayClient(String serverUrl, String appId, String privateKey, String format, String charset, String alipayPulicKey, String signType, String encryptKey, String encryptType) {
/*  97 */     this(serverUrl, appId, privateKey, format, charset, alipayPulicKey, signType);
/*     */     
/*  99 */     this.encryptType = encryptType;
/* 100 */     this.encryptKey = encryptKey;
/*     */   }
/*     */   
/*     */   public <T extends AlipayResponse> T execute(AlipayRequest<T> request) throws AlipayApiException {
/* 104 */     return execute(request, null);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public <T extends AlipayResponse> T execute(AlipayRequest<T> request, String accessToken) throws AlipayApiException {
/* 110 */     return execute(request, accessToken, null);
/*     */   }
/*     */ 
/*     */   
/*     */   public <T extends AlipayResponse> T execute(AlipayRequest<T> request, String accessToken, String appAuthToken) throws AlipayApiException {
/*     */     ObjectJsonParser objectJsonParser = null;
/* 116 */     AlipayParser<T> parser = null;
/* 117 */     if ("xml".equals(this.format)) {
/* 118 */       ObjectXmlParser objectXmlParser = new ObjectXmlParser(request.getResponseClass());
/*     */     } else {
/* 120 */       objectJsonParser = new ObjectJsonParser(request.getResponseClass());
/*     */     } 
/*     */     
/* 123 */     return _execute(request, (AlipayParser<T>)objectJsonParser, accessToken, appAuthToken);
/*     */   }
/*     */   
/*     */   public <T extends AlipayResponse> T pageExecute(AlipayRequest<T> request) throws AlipayApiException {
/* 127 */     return pageExecute(request, "POST");
/*     */   }
/*     */   
/*     */   public <T extends AlipayResponse> T pageExecute(AlipayRequest<T> request, String httpMethod) throws AlipayApiException {
/*     */     AlipayResponse alipayResponse = null;
/* 132 */     RequestParametersHolder requestHolder = getRequestHolderWithSign(request, null, null);
/*     */     
/* 134 */     if (AlipayLogger.isBizDebugEnabled().booleanValue()) {
/* 135 */       AlipayLogger.logBizDebug(getRedirectUrl(requestHolder));
/*     */     }
/* 137 */     T rsp = null;
/*     */     try {
/* 139 */       Class<T> clazz = request.getResponseClass();
/* 140 */       alipayResponse = (AlipayResponse)clazz.newInstance();
/* 141 */     } catch (InstantiationException e) {
/* 142 */       AlipayLogger.logBizError(e);
/* 143 */     } catch (IllegalAccessException e) {
/* 144 */       AlipayLogger.logBizError(e);
/*     */     } 
/* 146 */     if ("GET".equalsIgnoreCase(httpMethod)) {
/* 147 */       alipayResponse.setBody(getRedirectUrl(requestHolder));
/*     */     } else {
/* 149 */       String baseUrl = getRequestUrl(requestHolder);
/* 150 */       alipayResponse.setBody(WebUtils.buildForm(baseUrl, (Map)requestHolder.getApplicationParams()));
/*     */     } 
/* 152 */     return (T)alipayResponse;
/*     */   }
/*     */   public <T extends AlipayResponse> T sdkExecute(AlipayRequest<T> request) throws AlipayApiException {
/*     */     AlipayResponse alipayResponse = null;
/* 156 */     RequestParametersHolder requestHolder = getRequestHolderWithSign(request, null, null);
/*     */     
/* 158 */     if (AlipayLogger.isBizDebugEnabled().booleanValue()) {
/* 159 */       AlipayLogger.logBizDebug(getSdkParams(requestHolder));
/*     */     }
/* 161 */     T rsp = null;
/*     */     try {
/* 163 */       Class<T> clazz = request.getResponseClass();
/* 164 */       alipayResponse = (AlipayResponse)clazz.newInstance();
/* 165 */     } catch (InstantiationException e) {
/* 166 */       AlipayLogger.logBizError(e);
/* 167 */     } catch (IllegalAccessException e) {
/* 168 */       AlipayLogger.logBizError(e);
/*     */     } 
/* 170 */     alipayResponse.setBody(getSdkParams(requestHolder));
/* 171 */     return (T)alipayResponse;
/*     */   }
/*     */ 
/*     */   
/*     */   public <TR extends AlipayResponse, T extends AlipayRequest<TR>> TR parseAppSyncResult(Map<String, String> result, Class<T> requsetClazz) throws AlipayApiException {
/* 176 */     TR tRsp = null;
/* 177 */     String rsp = result.get("result");
/*     */     
/*     */     try {
/* 180 */       AlipayRequest<TR> alipayRequest = (AlipayRequest)requsetClazz.newInstance();
/* 181 */       Class<TR> responseClazz = alipayRequest.getResponseClass();
/*     */ 
/*     */       
/* 184 */       if (StringUtils.isEmpty(rsp)) {
/* 185 */         AlipayResponse alipayResponse = (AlipayResponse)responseClazz.newInstance();
/* 186 */         alipayResponse.setCode("20000");
/* 187 */         alipayResponse.setSubCode("ACQ.SYSTEM_ERROR");
/* 188 */         alipayResponse.setSubMsg(result.get("memo"));
/*     */       } else {
/* 190 */         ObjectJsonParser<TR> objectJsonParser = null; AlipayParser<TR> parser = null;
/* 191 */         if ("xml".equals(this.format)) {
/* 192 */           ObjectXmlParser objectXmlParser = new ObjectXmlParser(responseClazz);
/*     */         } else {
/* 194 */           objectJsonParser = new ObjectJsonParser(responseClazz);
/*     */         } 
/*     */ 
/*     */         
/* 198 */         tRsp = objectJsonParser.parse(rsp);
/* 199 */         tRsp.setBody(rsp);
/*     */ 
/*     */         
/* 202 */         checkResponseSign(alipayRequest, (AlipayParser<TR>)objectJsonParser, rsp, tRsp.isSuccess());
/* 203 */         if (!tRsp.isSuccess()) {
/* 204 */           AlipayLogger.logBizError(rsp);
/*     */         }
/*     */       } 
/* 207 */     } catch (RuntimeException e) {
/* 208 */       AlipayLogger.logBizError(rsp);
/* 209 */       throw e;
/* 210 */     } catch (AlipayApiException e) {
/* 211 */       AlipayLogger.logBizError(rsp);
/* 212 */       throw new AlipayApiException(e);
/* 213 */     } catch (InstantiationException e) {
/* 214 */       AlipayLogger.logBizError(rsp);
/* 215 */       throw new AlipayApiException(e);
/* 216 */     } catch (IllegalAccessException e) {
/* 217 */       AlipayLogger.logBizError(rsp);
/* 218 */       throw new AlipayApiException(e);
/*     */     } 
/* 220 */     return tRsp;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private <T extends AlipayResponse> RequestParametersHolder getRequestHolderWithSign(AlipayRequest<?> request, String accessToken, String appAuthToken) throws AlipayApiException {
/* 235 */     RequestParametersHolder requestHolder = new RequestParametersHolder();
/* 236 */     AlipayHashMap appParams = new AlipayHashMap(request.getTextParams());
/*     */ 
/*     */     
/*     */     try {
/* 240 */       if (request.getClass().getMethod("getBizContent", new Class[0]) != null && 
/* 241 */         StringUtils.isEmpty((String)appParams.get("biz_content")) && request
/* 242 */         .getBizModel() != null) {
/* 243 */         appParams.put("biz_content", (new JSONWriter())
/* 244 */             .write(request.getBizModel(), true));
/*     */       }
/* 246 */     } catch (NoSuchMethodException noSuchMethodException) {
/*     */     
/* 248 */     } catch (SecurityException e) {
/* 249 */       AlipayLogger.logBizError(e);
/*     */     } 
/*     */ 
/*     */     
/* 253 */     if (request.isNeedEncrypt()) {
/*     */       
/* 255 */       if (StringUtils.isEmpty((String)appParams.get("biz_content")))
/*     */       {
/* 257 */         throw new AlipayApiException("当前API不支持加密请求");
/*     */       }
/*     */ 
/*     */       
/* 261 */       if (!StringUtils.areNotEmpty(new String[] { this.encryptKey, this.encryptType }))
/*     */       {
/* 263 */         throw new AlipayApiException("API请求要求加密，则必须设置密钥和密钥类型：encryptKey=" + this.encryptKey + ",encryptType=" + this.encryptType);
/*     */       }
/*     */ 
/*     */       
/* 267 */       String encryptContent = AlipayEncrypt.encryptContent((String)appParams
/* 268 */           .get("biz_content"), this.encryptType, this.encryptKey, this.charset);
/*     */ 
/*     */       
/* 271 */       appParams.put("biz_content", encryptContent);
/*     */     } 
/*     */     
/* 274 */     if (!StringUtils.isEmpty(appAuthToken)) {
/* 275 */       appParams.put("app_auth_token", appAuthToken);
/*     */     }
/*     */     
/* 278 */     requestHolder.setApplicationParams(appParams);
/*     */     
/* 280 */     if (StringUtils.isEmpty(this.charset)) {
/* 281 */       this.charset = "UTF-8";
/*     */     }
/*     */     
/* 284 */     AlipayHashMap protocalMustParams = new AlipayHashMap();
/* 285 */     protocalMustParams.put("method", request.getApiMethodName());
/* 286 */     protocalMustParams.put("version", request.getApiVersion());
/* 287 */     protocalMustParams.put("app_id", this.appId);
/* 288 */     protocalMustParams.put("sign_type", this.sign_type);
/* 289 */     protocalMustParams.put("terminal_type", request.getTerminalType());
/* 290 */     protocalMustParams.put("terminal_info", request.getTerminalInfo());
/* 291 */     protocalMustParams.put("notify_url", request.getNotifyUrl());
/* 292 */     protocalMustParams.put("return_url", request.getReturnUrl());
/* 293 */     protocalMustParams.put("charset", this.charset);
/*     */     
/* 295 */     if (request.isNeedEncrypt()) {
/* 296 */       protocalMustParams.put("encrypt_type", this.encryptType);
/*     */     }
/*     */     
/* 299 */     Long timestamp = Long.valueOf(System.currentTimeMillis());
/* 300 */     DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/* 301 */     df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
/* 302 */     protocalMustParams.put("timestamp", df.format(new Date(timestamp.longValue())));
/* 303 */     requestHolder.setProtocalMustParams(protocalMustParams);
/*     */     
/* 305 */     AlipayHashMap protocalOptParams = new AlipayHashMap();
/* 306 */     protocalOptParams.put("format", this.format);
/* 307 */     protocalOptParams.put("auth_token", accessToken);
/* 308 */     protocalOptParams.put("alipay_sdk", "alipay-sdk-java-dynamicVersionNo");
/* 309 */     protocalOptParams.put("prod_code", request.getProdCode());
/* 310 */     requestHolder.setProtocalOptParams(protocalOptParams);
/*     */     
/* 312 */     if (!StringUtils.isEmpty(this.sign_type)) {
/*     */       
/* 314 */       String signContent = AlipaySignature.getSignatureContent(requestHolder);
/* 315 */       protocalMustParams.put("sign", 
/* 316 */           AlipaySignature.rsaSign(signContent, this.privateKey, this.charset, this.sign_type));
/*     */     } else {
/*     */       
/* 319 */       protocalMustParams.put("sign", "");
/*     */     } 
/* 321 */     return requestHolder;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private String getRequestUrl(RequestParametersHolder requestHolder) throws AlipayApiException {
/* 332 */     StringBuffer urlSb = new StringBuffer(this.serverUrl);
/*     */     try {
/* 334 */       String sysMustQuery = WebUtils.buildQuery((Map)requestHolder.getProtocalMustParams(), this.charset);
/*     */       
/* 336 */       String sysOptQuery = WebUtils.buildQuery((Map)requestHolder.getProtocalOptParams(), this.charset);
/*     */       
/* 338 */       urlSb.append("?");
/* 339 */       urlSb.append(sysMustQuery);
/* 340 */       if ((((sysOptQuery != null) ? 1 : 0) & ((sysOptQuery.length() > 0) ? 1 : 0)) != 0) {
/* 341 */         urlSb.append("&");
/* 342 */         urlSb.append(sysOptQuery);
/*     */       } 
/* 344 */     } catch (IOException e) {
/* 345 */       throw new AlipayApiException(e);
/*     */     } 
/*     */     
/* 348 */     return urlSb.toString();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private String getRedirectUrl(RequestParametersHolder requestHolder) throws AlipayApiException {
/* 359 */     StringBuffer urlSb = new StringBuffer(this.serverUrl);
/*     */     try {
/* 361 */       Map<String, String> sortedMap = AlipaySignature.getSortedMap(requestHolder);
/* 362 */       String sortedQuery = WebUtils.buildQuery(sortedMap, this.charset);
/* 363 */       String sign = (String)requestHolder.getProtocalMustParams().get("sign");
/* 364 */       urlSb.append("?");
/* 365 */       urlSb.append(sortedQuery);
/* 366 */       if ((((sign != null) ? 1 : 0) & ((sign.length() > 0) ? 1 : 0)) != 0) {
/* 367 */         Map<String, String> signMap = new HashMap<String, String>();
/* 368 */         signMap.put("sign", sign);
/* 369 */         String signQuery = WebUtils.buildQuery(signMap, this.charset);
/* 370 */         urlSb.append("&");
/* 371 */         urlSb.append(signQuery);
/*     */       } 
/* 373 */     } catch (IOException e) {
/* 374 */       throw new AlipayApiException(e);
/*     */     } 
/*     */     
/* 377 */     return urlSb.toString();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private String getSdkParams(RequestParametersHolder requestHolder) throws AlipayApiException {
/* 388 */     StringBuffer urlSb = new StringBuffer();
/*     */     try {
/* 390 */       Map<String, String> sortedMap = AlipaySignature.getSortedMap(requestHolder);
/* 391 */       String sortedQuery = WebUtils.buildQuery(sortedMap, this.charset);
/* 392 */       urlSb.append(sortedQuery);
/* 393 */     } catch (IOException e) {
/* 394 */       throw new AlipayApiException(e);
/*     */     } 
/*     */     
/* 397 */     return urlSb.toString();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private <T extends AlipayResponse> T _execute(AlipayRequest<T> request, AlipayParser<T> parser, String authToken, String appAuthToken) throws AlipayApiException {
/* 404 */     Map<String, Object> rt = doPost(request, authToken, appAuthToken);
/* 405 */     if (rt == null) {
/* 406 */       return null;
/*     */     }
/*     */     
/* 409 */     T tRsp = null;
/*     */ 
/*     */ 
/*     */     
/*     */     try {
/* 414 */       ResponseEncryptItem responseItem = encryptResponse(request, rt, parser);
/*     */ 
/*     */       
/* 417 */       tRsp = parser.parse(responseItem.getRealContent());
/* 418 */       tRsp.setBody(responseItem.getRealContent());
/*     */ 
/*     */       
/* 421 */       checkResponseSign(request, parser, responseItem.getRespContent(), tRsp.isSuccess());
/*     */     }
/* 423 */     catch (RuntimeException e) {
/*     */       
/* 425 */       AlipayLogger.logBizError((String)rt.get("rsp"));
/* 426 */       throw e;
/* 427 */     } catch (AlipayApiException e) {
/*     */       
/* 429 */       AlipayLogger.logBizError((String)rt.get("rsp"));
/* 430 */       throw new AlipayApiException(e);
/*     */     } 
/*     */     
/* 433 */     tRsp.setParams((Map<String, String>)rt.get("textParams"));
/* 434 */     if (!tRsp.isSuccess()) {
/* 435 */       AlipayLogger.logErrorScene(rt, (AlipayResponse)tRsp, "");
/*     */     }
/* 437 */     return tRsp;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private <T extends AlipayResponse> Map<String, Object> doPost(AlipayRequest<T> request, String accessToken, String appAuthToken) throws AlipayApiException {
/* 452 */     Map<String, Object> result = new HashMap<String, Object>();
/* 453 */     RequestParametersHolder requestHolder = getRequestHolderWithSign(request, accessToken, appAuthToken);
/*     */ 
/*     */     
/* 456 */     String url = getRequestUrl(requestHolder);
/*     */ 
/*     */     
/* 459 */     if (AlipayLogger.isBizDebugEnabled().booleanValue()) {
/* 460 */       AlipayLogger.logBizDebug(getRedirectUrl(requestHolder));
/*     */     }
/*     */     
/* 463 */     String rsp = null;
/*     */     try {
/* 465 */       if (request instanceof AlipayUploadRequest) {
/* 466 */         AlipayUploadRequest<T> uRequest = (AlipayUploadRequest<T>)request;
/* 467 */         Map<String, FileItem> fileParams = AlipayUtils.cleanupMap(uRequest.getFileParams());
/* 468 */         rsp = WebUtils.doPost(url, (Map)requestHolder.getApplicationParams(), fileParams, this.charset, this.connectTimeout, this.readTimeout);
/*     */       } else {
/*     */         
/* 471 */         rsp = WebUtils.doPost(url, (Map)requestHolder.getApplicationParams(), this.charset, this.connectTimeout, this.readTimeout);
/*     */       }
/*     */     
/* 474 */     } catch (IOException e) {
/* 475 */       throw new AlipayApiException(e);
/*     */     } 
/* 477 */     result.put("rsp", rsp);
/* 478 */     result.put("textParams", requestHolder.getApplicationParams());
/* 479 */     result.put("protocalMustParams", requestHolder.getProtocalMustParams());
/* 480 */     result.put("protocalOptParams", requestHolder.getProtocalOptParams());
/* 481 */     result.put("url", url);
/* 482 */     return result;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private <T extends AlipayResponse> void checkResponseSign(AlipayRequest<T> request, AlipayParser<T> parser, String responseBody, boolean responseIsSucess) throws AlipayApiException {
/* 499 */     if (!StringUtils.isEmpty(this.alipayPublicKey)) {
/*     */       
/* 501 */       SignItem signItem = parser.getSignItem(request, responseBody);
/*     */       
/* 503 */       if (signItem == null)
/*     */       {
/* 505 */         throw new AlipayApiException("sign check fail: Body is Empty!");
/*     */       }
/*     */       
/* 508 */       if (responseIsSucess || (!responseIsSucess && 
/* 509 */         !StringUtils.isEmpty(signItem.getSign()))) {
/*     */         
/* 511 */         boolean rsaCheckContent = AlipaySignature.rsaCheck(signItem.getSignSourceDate(), signItem
/* 512 */             .getSign(), this.alipayPublicKey, this.charset, this.sign_type);
/*     */         
/* 514 */         if (!rsaCheckContent)
/*     */         {
/*     */           
/* 517 */           if (!StringUtils.isEmpty(signItem.getSignSourceDate()) && signItem
/* 518 */             .getSignSourceDate().contains("\\/")) {
/*     */             
/* 520 */             String srouceData = signItem.getSignSourceDate().replace("\\/", "/");
/*     */             
/* 522 */             boolean jsonCheck = AlipaySignature.rsaCheck(srouceData, signItem.getSign(), this.alipayPublicKey, this.charset, this.sign_type);
/*     */ 
/*     */             
/* 525 */             if (!jsonCheck) {
/* 526 */               throw new AlipayApiException("sign check fail: check Sign and Data Fail！JSON also！");
/*     */             }
/*     */           }
/*     */           else {
/*     */             
/* 531 */             throw new AlipayApiException("sign check fail: check Sign and Data Fail!");
/*     */           } 
/*     */         }
/*     */       } 
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private <T extends AlipayResponse> ResponseEncryptItem encryptResponse(AlipayRequest<T> request, Map<String, Object> rt, AlipayParser<T> parser) throws AlipayApiException {
/* 552 */     String responseBody = (String)rt.get("rsp");
/*     */     
/* 554 */     String realBody = null;
/*     */ 
/*     */     
/* 557 */     if (request.isNeedEncrypt()) {
/*     */ 
/*     */       
/* 560 */       realBody = parser.encryptSourceData(request, responseBody, this.format, this.encryptType, this.encryptKey, this.charset);
/*     */     
/*     */     }
/*     */     else {
/*     */       
/* 565 */       realBody = (String)rt.get("rsp");
/*     */     } 
/*     */     
/* 568 */     return new ResponseEncryptItem(responseBody, realBody);
/*     */   }
/*     */ }


/* Location:              C:\Users\Administrator\Downloads\jd-gui-windows-1.6.6\jd-gui-windows-1.6.6\alipay-sdk-1.1.jar!\com\alipay\api\DefaultAlipayClient.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       1.1.3
 */